from tkinter import *
root = Tk()
root.title("ИТ марaфон")
root.geometry("500x500")
Canvas = Canvas(bg="white", width=500, height=500)
Canvas.pack(anchor=CENTER, expand=1)

#фигура
print("введите k")
k = float( input("k = "))
x = int( input("x = "))
y = int( input("y = "))

Canvas.create_rectangle(0+x, (0+y), (50*k+x), 100*k+y, fill="red", outline='red')
Canvas.create_rectangle(100*k+x, (150*k+y), (50*k+x), 50*k+y, fill="red", outline='red')
if k == 0 and x>= 0 and x<=500 and y>=0 and y<=500:
    pass
else:
    if k> 0 and 20*k+x>= 0 and 0*k+y>= 0 and 20*k+x<=500 and 0*k+y<=500:
        pass
    else:
        if k< 0 and 20*k+x>=0 and 20*k+y>=0 and 0*k+x<=500 and 0*k+y<=500 and 0*k+y<=500:
            pass
        else:
            print("Размер фигуры превышает размер поля")
            exit()
root.mainloop()
